<ul class="nav nav-tabs">
    {% for i in return_list %}
        {% if i.menu_num == 0 %}
            <li class="active"><a data-toggle="tab" href="#{{ i.menu_name }}">{{ i.menu_name }}</a></li>
        {% else %}
            <li><a data-toggle="tab" href="#{{ i.menu_name }}">{{ i.menu_name }}</a></li>
        {% endif %}
    {% endfor %}
</ul>

<div class="tab-content">
    {% for i in return_list %}
        {% if i.menu_num == 0 %}
            <div id="{{ i.menu_name }}" class="tab-pane fade in action in active">
        {% else %}
            <div id="{{ i.menu_name }}" class="tab-pane fade in action">
        {% endif %}
    <div>&nbsp</div>
    {% for ii in i.menu_val %}
        {% if i.menu_name == 'event_overview' %}
            <table class="table table-striped table-bordered table-hover column" id="tab_id_{{ i.menu_name }}">
                <span style="color:red;">{{ ii.desc }}</span>
                <thead>
                <tr>
                    <th>
                        kill_command
                    </th>
                    {% for col_name in ii.columns %}
                        <th>{{ col_name }}</th>
                    {% endfor %}
                </tr>
                </thead>
                {#                <tbody>#}
                {#                {% for result in ii.result %}#}
                {#                    <tr>#}
                {#                        <td>#}
                {#                            <a href="javascript:void(0);" onclick="show_kill_session_detail_1('{{ col_value }}')">kill_current_session</a>#}
                {#                        </td>#}
                {#                        {% for col_value in result %}#}
                {#                            <td>#}
                {#                                {% if forloop.counter == 1 %}#}
                {#                                    <!-- 第一列添加 <a> 标签 -->#}
                {#                                    <a href="javascript:void(0);" onclick="show_kill_session_detail('{{ col_value }}')">{{ col_value | default_if_none:"" }} </a>#}
                {#                                {% elif forloop.counter == 4 %}#}
                {#                                    <!-- 第四列添加 <a> 标签 -->#}
                {#                                    <a href="javascript:void(0);"  onclick="show_sql_explain('{{ col_value }}')">{{ col_value | default_if_none:"" }}</a>#}
                {#                                {% else %}#}
                {#                                    <!-- 其他列正常显示 -->#}
                {#                                    <pre style="border: none; padding: 0; margin: 0; background: none;">{{ col_value | default_if_none:"" }}</pre>#}
                {#                                {% endif %}#}
                {#                            </td>#}
                {#                        {% endfor %}#}
                {#                    </tr>#}
                {#                {% endfor %}#}
                {#                </tbody>#}
                <tbody>
                {% for result in ii.result %}
                    {% with first_value=result.0 %}  {# 获取当前行的第一列值 #}
                        <tr>
                            <td>
                                <a href="javascript:void(0);" onclick="confirmKillSession('{{ first_value }}')">kill_current_session</a>
                            </td>
                            {% for col_value in result %}
                                <td>
                                    {% if forloop.counter == 1 %}
                                        <a href="javascript:void(0);"
                                           onclick="show_kill_session_detail('{{ col_value }}')">{{ col_value | default_if_none:"" }} </a>
                                    {% elif  forloop.counter == 13 %}
                                        <a href="javascript:void(0);"
                                           onclick="show_kill_session_detail('{{ col_value }}')"
                                           style="color: red;">{{ col_value | default_if_none:"" }} </a>
                                    {% elif forloop.counter == 4 %}
                                        <a href="javascript:void(0);"
                                           onclick="show_sql_explain('{{ col_value }}')">{{ col_value | default_if_none:"" }}</a>
                                    {% else %}
                                        <pre style="border: none; padding: 0; margin: 0; background: none;">{{ col_value | default_if_none:"" }}</pre>
                                    {% endif %}
                                </td>
                            {% endfor %}
                        </tr>
                    {% endwith %}
                {% endfor %}
                </tbody>

            </table>
        {% else %}
            <table class="table table-striped table-bordered table-hover column" id="tab_id_{{ i.menu_name }}">
                <span style="color:red;">{{ ii.desc }}</span>
                <thead>
                <tr>
                    {% for col_name in ii.columns %}
                        <th>{{ col_name }}</th>
                    {% endfor %}
                </tr>
                </thead>
                <tbody>
                {% for result in ii.result %}
                    <tr>
                        {% for col_value in result %}
                            {#                                        <td><pre  style="display:inline;  border: none">{{ col_value }}</pre></td>#}
                            <td>
                                {#                                <pre style="display:inline-table; border: none">{{ col_value }}</pre>#}
                                {#                            {{ col_value | default_if_none:"" }}#}
                                <pre style="border: none;padding: 0;margin: 0;background: none;"> {{ col_value | default_if_none:"" }}</pre>
                            </td>
                        {% endfor %}
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        {% endif %}
    {% endfor %}
    </div>
    {% endfor %}
    </div>
</div>

<style>
    /* 调整 SweetAlert2 按钮大小 */
    .swal-confirm-button {
        font-size: 18px !important; /* 增大字体 */
        padding: 10px 24px !important; /* 增大内边距 */
    }

    .swal-cancel-button {
        font-size: 18px !important; /* 增大字体 */
        padding: 10px 24px !important; /* 增大内边距 */
    }
</style>